package com.umbacos.udm.client.arch;

import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.Widget;

public class HourGlass extends PopupPanel {

	private Widget holder=null;
	private final Image hourglassImage = new Image("images/spinner_big.gif");	    

	public HourGlass(Widget holder){
		super(false);
		this.holder=holder;
		add(hourglassImage);
		setAnimationEnabled(true);
	}

	public void wait(boolean b) {
		if (b) {
			if (holder!=null)
				setPopupPosition(
						holder.getAbsoluteLeft()+(holder.getOffsetWidth()-getOffsetWidth())/2, 
						holder.getAbsoluteTop()+(holder.getOffsetHeight()-getOffsetHeight())/2);
			show();
		} else {
			hide();
		}
	}
}
